﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace NIEN_LUAN
{
    public partial class FormReportDoanhthu : Form
    {
        private Db.DataContentDataContext db = new NIEN_LUAN.Db.DataContentDataContext();
        private FormThongKeDoanhThu frmThongkedoanhthu;

        public FormReportDoanhthu()
        {
            InitializeComponent();
        }

        public FormReportDoanhthu(FormThongKeDoanhThu frm)
        {
            frmThongkedoanhthu = frm;
            InitializeComponent();
        }

        private void FormDoanhthuReport_Load(object sender, EventArgs e)
        {
            var phieuthu = (from m in db.PHIEUTHUs
                           //where here
                           //ở đ^ay anh select v^ề 1 chung tu thong ke
                           select new Db.Chitietchungtuthongke
                           {

                               NgayLap = m.NgayLap ?? DateTime.Now,//neu ngay lap ma null thi lay ngay hien tai
                               SoChungTu = m.SoChungTu,
                               TenNhanVienLap = m.NHANVIEN.TenNhanVien,                               
                               TenKhachHang=m.CHUNGTU.KHACHHANG.TenKhachHang,
                               SoPhieuThu=m.SoPhieuThu,
                               SoTien=m.SoTien??0,
                               MaNhanVien=m.NHANVIEN.MaNhanVien,
                               TenNhanVien=m.NHANVIEN.TenNhanVien,
                               TongTien=m.SoTien ??0,
                           }).ToList();
            this.BindingSource.DataSource = phieuthu;
            this.reportViewer1.RefreshReport();
        }

       
    }
}
